package com.lanqiao.javaparkinglot.dao;

import com.lanqiao.javaparkinglot.entity.Yg;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Mapper
public interface YgDao {
    //查询
    @Select("select * from tb_yg")
    List<Yg> findYg();
    //添加
    @Update("insert into tb_yg (yg_id, yg_name, yg_sex, yg_tele, yg_post, yg_card, yg_address) VALUES(#{yg_id},#{yg_name},#{yg_sex},#{yg_tele},#{yg_post},#{yg_card},#{yg_address}) ")
    @Transactional
    void addyg(Yg yg);
    //修改
    @Update("update tb_yg set yg_id=#{yg_id}, yg_name=#{yg_name}, yg_sex=#{yg_sex}, yg_tele=#{yg_tele}, yg_post=#{yg_post}, yg_card=#{yg_card}, yg_address=#{yg_address} where yg_id=#{yg_id}")
    @Transactional
    void updateyg(Yg yg);
    //删除
    @Delete("delete from tb_yg where yg_id=#{yg_id}")
    void deleteyg(Long yg_id);

}
